from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from game.views import *



# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Example:
    # (r'^solidaridad/', include('solidaridad.foo.urls')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    (r'^admin/', include(admin.site.urls)),    
    (r'^accounts/login/$',  login),
    (r'^accounts/logout/$', logout),
    (r'^account/loggedout/$', mylogout),
    (r'^logout/$', logout),    

    (r'^accounts/profile/$', login), #redirect to avoid the 404 error
    (r'^accounts/$', login),  #redirect to avoid the 404 error
    (r'^login/$', login),  #redirect to avoid the 404 error
    (r'^no_such_page/$', no_such_page1), #redirect to avoid 404 error

    #register & edit user
    (r'^register/$', generateAddUserForm),
    #(r'^editUser/$', editUserForm),

    #items
    (r'^items/$', view_items),
    (r'^myitems/$', view_my_items),
    (r'^buyitem/(\w+)/$',buy_item),

    #quests
    (r'^quests/$', view_quests),
    (r'^myquests/$', view_my_quests),
    #(r'^doquest/(\w+)/$',do_quest),
    (r'^doquest/(\w+)/$',solve),

    #top10 players
    (r'^top10/$', view_top10users),

    #developers, faq, manual
    (r'^developers/$', view_developers),
    (r'^faq/$', view_faq),
    (r'^manual/$', view_manual),

    #solution to 404 errors
    (r'^$', login), #redirect  to INDEX PAGE    
    (r'^(\w+)/(\w+)/$', no_such_page), #redirect  to no_such_page to avoid the 404 error
    (r'^((\w+)/)*$', no_such_page), #redirect  to no_such_page to avoid the 404 error

    (r'^static/(?P<path>.*)$','django.views.static.serve',
                    {'document_root': './game/static/'}),
)
